package factory;

import dao.PetDao;
import dao.PetDaoMySQLImpl;
import dao.PetDaoOracleImpl;

public class PetDaoFactory {
    //此默认名称可以通过读取properties配置文件进行修改
    public static String defaultBeanName = "petDaoMySQLImpl";

    public static PetDao getInstance(String beanName){
        PetDao petDao = null;
        switch (beanName){
            case "petDaoMySQLImpl":
                petDao = new PetDaoMySQLImpl();
                break;
            case "petDaoOralceImpl":
                petDao = new PetDaoOracleImpl();
                break;
            default:
                throw new RuntimeException("未找到'"+beanName+"'对应的对象.");
        }
        return petDao;
    }
}
